package org.javaboy.properties_demo;

import org.javaboy.properties_demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    //    @Value("${javaboy.name}")
    String name;
    //    @Value("${javaboy.address}")
    String address;

    @Autowired
    User user;

    @Value("${project.name}")
    String projectName;

    @GetMapping("/hello")
    public String hello() {
        System.out.println("address = " + address);
        return name + ":" + address + ":" + projectName;
    }

    @GetMapping("/user")
    public User getUser() {
        return user;
    }
}
